/*
 * A Gneral purpose java based Genome Library created by Susanta Tewari.
 * Copyright is protected. Contact Susanta Tewari at <statsusant@yahoo.com>
 */

package genomemap.maps;

import genomemap.data.PDataSource;
import genomemap.data.PhysicalMapService;
import genomemap.tagging.LinkingCloneStrategy;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Susanta Tewari <stewari@yahoo.com>
 */
public class CompressedHybridizationMap extends HybridizationMap {

    /**
     * Constructs ...
     *
     * @param ch_id description
     * @param probeOrder description
     */
    public CompressedHybridizationMap(int ch_id, int[] probeOrder) {

        super(ch_id, probeOrder);

        Map<Integer, Boolean> gapStatus = new HashMap<>();


        // the following loads gap status besides creating clones
        this.setClones(Arrays.asList(PhysicalMapService.getMinimalPathClones(ch_id, probeOrder,
                new LinkingCloneStrategy(), gapStatus)));


        // set the gap status
        this.setGapStatus(gapStatus);
    }

    /**
     * Constructs ...
     *
     * @param pData description
     */
    public CompressedHybridizationMap(PDataSource pData) {
        this(pData.getChData().getChId(), pData.getOrder());
    }

    public static void main(String[] args) {

        int ch_id                                = 6;
        int[] order                              = {

            157, 14, 85, 23, 15, 173, 128, 76, 108, 71, 114, 99, 26, 123, 59, 61, 168, 147, 73, 139,
            37, 57, 155, 115, 117, 79, 62, 166, 16, 136, 65, 33, 87, 52, 120, 119, 100, 91, 109,
            161, 101, 112, 39, 32, 135, 125, 95, 28, 93, 143, 113, 55, 38, 156, 12, 63, 153, 77,
            167, 111, 88, 89, 122, 124, 30, 17, 131, 49, 130, 116, 40, 47, 94, 19, 145, 78, 43, 21,
            66, 165, 146, 127, 11, 174, 164, 7, 171, 27, 53, 107, 151, 22, 67, 129, 159, 103, 36,
            142, 118, 175, 106, 31, 81, 134, 133, 3, 137, 97, 1, 96, 20, 80, 34, 90, 68, 169, 170,
            163, 50, 13, 75, 46, 172, 58, 48, 5, 110, 138, 64, 35, 144, 8, 82, 41, 126, 132, 51, 69,
            150, 29, 158, 74, 6, 141, 56, 45, 44, 121, 42, 2, 92, 70, 72, 84, 162, 18, 60, 160, 4,
            24, 83, 9, 86, 148, 149, 154, 54, 105, 102, 104, 10, 140, 98, 152, 25, 176
        };
        CompressedHybridizationMap compressedMap = new CompressedHybridizationMap(ch_id, order);

        System.out.println(compressedMap.getMapString());
    }
}
